<template>
    <div>

	 	<div class="container" style="border: none;">

			
			<el-table
				:data="list"
				border
				v-loading="ifload"
				>
				<el-table-column
					prop="id"
					label="活动ID"
                    align="center"
					width="80">
				</el-table-column>
				<el-table-column
					prop="in_num"
                    align="center"
					label="金额"
					width="320">
				</el-table-column>
				<el-table-column
					prop="bonus_day"
                    align="center"
					label="已释放天数"
					width="120">
				</el-table-column>
				<el-table-column
					prop="period_day"
                    align="center"
					label="合约总天数"
					width="120">
				</el-table-column>
				<el-table-column
					prop="status"
                    align="center"
					label="状态"
					width="120" >
                    <template slot-scope="scope">
                     {{scope.row.status | statusFilter}}
                    </template>
				</el-table-column>
                <el-table-column
                	prop="create_time"
                    align="center"
                	label="创建时间">
                </el-table-column>
			</el-table>

            <div class="pagination">
                <el-pagination background
					@current-change="handleCurrentChange"
					layout="prev, pager, next"
					:total="pages"
					:page-size="page_size">
                </el-pagination>
            </div>
		</div>

 	</div>
</template>

<script type="text/javascript">
import {download} from '@/components/js/request'
export default{
	data() {
		return {
			ifload:true,
			list:[],
            total:0,

			page:1,
			page_size:10,
			pages:0,

			search:{
				member_id:'',
                date:'',
                balance_type:""
			}
		}
	},
	created() {
		this.$nextTick(()=>{
			this.getData();
		})
	},
	computed:{
	},
	methods:{
		getData() {
             this.search.member_id = this.$route.query.member_id
			let params = {
				page:this.page,
				page_size:this.page_size,
				search:JSON.stringify(this.search),
			}
			this.ifload = true;
			this.$post_('finance/invest/invset_list',params,(res) => {
				console.log(res);
				if(res.code=='0'){
					this.list = res.data;
					this.pages = Number(res.extend.pages);
                    this.total = res.extend.total;
					this.ifload = false;
				}
			});
		},
        // 分页导航
        handleCurrentChange(val) {
            this.page = val;
            this.getData();
        },
		//搜索
		searchRes() {
			this.page = 1;
			this.getData();
		},

	},
    filters:{
        statusFilter(value){
            if(value == '1'){
               return  value ="收益中"
            }else if(value == '2'){
               return  value ="完成"
            }
        }
    }
}
</script>

<style type="text/css">
    thead tr th{
        text-align: center;
    }
    .red{
        color: #ff0000;
    }
	.search{
		margin-bottom: 10px;
	}
</style>
